package com.llc.spring.cloud.sdk.spring;

import com.llc.spring.cloud.sdk.core.proxy.Proxy;
import org.springframework.beans.factory.FactoryBean;

/**
 * time 2018/8/28 11:45
 *
 * @author xiaojie.zhu <br>
 */
public class ApiFactoryBean implements FactoryBean {
    private Class<?> t;

    public ApiFactoryBean(Class<?> t) {
        this.t = t;
    }

    @Override
    public Object getObject() throws Exception {
        Object instance = Proxy.newInstance(t);
        return instance;
    }

    @Override
    public Class<?> getObjectType() {
        return t;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
